﻿@{
    Layout = null;
}

<form id="form_AllotCodeAdd" role="form" class="form-horizontal" onkeydown="if(event.keyCode==13){return false;}">
    <div class="form-group">
        <div class="col-xs-2 col-md-2 text-right">
            分配机构:
        </div>
        <div class="col-xs-10 col-md-10">
            <input disabled="disabled" id="AllotEntepriseName" class="form-control" />
        </div>
    </div>
    <div class="form-group">
        <div class="col-xs-2 col-md-2 text-right">
            分往机构:
        </div>
        <div class="col-xs-10 col-md-10">
            <input disabled="disabled" id="DirectSubLevel" class="form-control" />
        </div>
    </div>
    <div class="form-group">
        <div class="col-xs-2 col-md-2 text-right">
            应用产品:
        </div>
        <div class="col-xs-10 col-md-10">
            <input disabled="disabled" id="ProductSelect" class="form-control" />
        </div>
    </div>
    <div class="form-group">
        <div class="col-xs-2 col-md-2 text-right">
            应用品牌:
        </div>
        <div class="col-xs-4 col-md-4">
            <input type="text" name="name" value=" " class="form-control" />
        </div>

        <div class="col-xs-2 col-md-2 text-right">
            产品规格:
        </div>
        <div class="col-xs-4 col-md-4">
            <input id="ProductSize" disabled="disabled" type="text" name="name" value=" " class="form-control" />
        </div>
    </div>
    <div class="form-group">
        <div class="col-xs-2 col-md-2 text-right">
            分配方式：
        </div>
        <div class="col-xs-2 col-md-2">
            <input id="AllotType" readonly="readonly" type="text" name="name" value=" " class="form-control" />
        </div>
    </div>
    <div class="form-group">
        <div class="col-xs-2 col-md-2 text-right">
            生码批次:
        </div>
        <div class="col-xs-4 col-md-4">
            <input id="GenCodeBatch" readonly="readonly" type="text" name="name" value=" " class="form-control" />
        </div>
    </div>
    <div id="NeedStatEndCode" class="form-group">
        <div class="col-xs-2 col-md-2 text-right">
            起始号
        </div>
        <div class="col-xs-4 col-md-4">
            <input type="text" readonly="readonly" id="StartCode" name="name" class="form-control" />
        </div>

        <div class="col-xs-2 col-md-2 text-right">
            结束号
        </div>
        <div class="col-xs-4 col-md-4">
            <input type="text" readonly="readonly" id="EndCode" name="name" class="form-control" />
        </div>
    </div>
    <div class="form-group">
        <div class="col-xs-2 col-md-2 text-right">
            数量:
        </div>
        <div class="col-xs-5 col-md-5">
            <input type="number" min="0" readonly="readonly" id="AllotCount" name="name" value=" " class="form-control" />
        </div>
        （单标）
    </div>
    <div class="form-group">
        <div class="col-xs-2 col-md-2 text-right">
            申请人:
        </div>
        <div class="col-xs-5 col-md-5">
            <input type="text" min="0" readonly="readonly" id="ApplyUser" name="name" value=" " class="form-control" />
        </div>
    </div>
    <div class="form-group">
        <div class="col-xs-2 col-md-2 text-right">
            申请理由:
        </div>
        <div class="col-xs-5 col-md-5">
            <input type="text" min="0" readonly="readonly" id="ApplyReason" name="name" value=" " class="form-control" />
        </div>
    </div>
    <div class="form-group">
        <div class="col-xs-2 col-md-2 text-right">
            审核结果:
        </div>
        <div class="col-xs-5 col-md-5">
            <input type="text" min="0" readonly="readonly" id="VerifieState" name="name" value=" " class="form-control" />
        </div>
    </div>
    <div class="form-group">
        <div class="col-xs-2 col-md-2 text-right">
            审核说明:
        </div>
        <div class="col-xs-5 col-md-5">
            <input type="text" min="0" readonly="readonly" id="VerificationNotes" name="name" value=" " class="form-control" />
        </div>
    </div>
</form>

<script type="text/javascript">
    if (DataModel) {
        $("#AllotEntepriseName").val(DataModel.F_EnterpriseName);
        $("#DirectSubLevel").val(DataModel.T_EnterpriseName);
        $("#ProductSelect").val(DataModel.AllotProductName);
        $("#ProductSize").val(DataModel.ApplyProductSize);
        if (DataModel.AllotType == 0) {
            //0：号段分配  1：整批分配 2:手机码关联
            $("#AllotType").val("号段分配");
        } else if (DataModel.AllotType == 1) {
            $("#AllotType").val("整批分配");
            $("#NeedStatEndCode").hide("fast");
        } else {
            $("#AllotType").val("手机码关联");
        }
        $("#GenCodeBatch").val(DataModel.AllotBatch);
        $("#StartCode").val(DataModel.StartCode);
        $("#EndCode").val(DataModel.EndCode);
        $("#AllotCount").val(DataModel.AllotCount);
        if (DataModel.F_EnterpriseId == 1)
        {
            $("#AllotCount").val(DataModel.ApplyCount);
        }
        $("#ApplyUser").val(DataModel.ApplyUserName);
        $("#ApplyReason").val(DataModel.ApplyReason);
        $("#AllotEntepriseName").val(DataModel.F_EnterpriseName);
        if (DataModel.HasVerifie == 0) {
            //0 末审核 1 通过  2 未通过
            $("#VerifieState").val("末审核");
        } else if (DataModel.HasVerifie == 1) {
            $("#VerifieState").val("通过");
        } else {
            $("#VerifieState").val("未通过");
        }
        $("#VerificationNotes").val(DataModel.VerificationNotes);
    }

    $(function () {
        $('#form_AllotCodeAdd').bootstrapValidator({
            fields: {
                StartCode: {
                    validators: {
                        regexp: {
                            regexp: /^[1-9]*[1-9][0-9]*$/,
                            message: '起始码为正整数'
                        },
                        notEmpty: {
                            message: '起始码不能为空'
                        }
                    }
                },
                EndCode: {
                    validators: {
                        regexp: {
                            regexp: /^[1-9]*[1-9][0-9]*$/,
                            message: '结束码为正整数'
                        },
                        notEmpty: {
                            message: '结束码不能为空'
                        }
                    }
                }
            }
        })
    })
</script>